package main
import "fmt"
func sumFn(x int,y int)int{
	sum:=x+y
	return sum
}
func Sub(x int,y int)int{
	fmt.Println(x,y)
	sub:=x-y
	return sub
}
func SubSimple(x,y int)int{
	sub:=x-y
	return sub
}
func SumMany(x ...int)int{
     //fmt.Printf("%v-%T\n",x,x)
	 sum:=0
	 for _,v :=range x{
		sum+=v 
	 }
	 return sum
}
func SumAllMany(x int,y ...int)int{
	sum:=x
	for _,v:=range y{
		sum+=v
	}
	return sum
}
func main(){
	result:=sumFn(18,58)
	fmt.Println("result=",result)
	result2:=sumFn(28,79)
	fmt.Println("result2=",result2)
	result3:=Sub(89,28)
	fmt.Println("result3=",result3)
	a:=190
	b:=27
	result4:=Sub(a,b)
	fmt.Println("result4=",result4)
	result5:=SubSimple(a,b)
	fmt.Println("result5=",result5)
	//可变参数...
    result6:=SumMany()
	result7:=SumMany(189,39)
	result8:=SumMany(78)
	fmt.Println("result6=",result6)
	fmt.Println("result7=",result7)
	fmt.Println("result8=",result8)
	//固定参数和可变参数
	result9:=SumAllMany(89)
	result10:=SumAllMany(89,70)
	result11:=SumAllMany(89,68,48,59)
	fmt.Println(result9)
	fmt.Println(result10)
	fmt.Println(result11)

}